package com.isoft.argi.dao;
import com.isoft.argi.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.sql.Connection;

@Mapper

public interface UserDao {

	@Update("UPDATE users SET uname=#{name},upwd=#{pwd} WHERE uid=#{id}")
	public int userEdit(String id, String name, String pwd);

	@Insert("INSERT INTO users VALUES (UUID(),#{name},#{pwd},#{email},#{phone},NOW())")
	public int userRegister(String name, String pwd, String email, String phone);

	@Select("select * from users where uname=#{name} and upwd=#{pwd}")
	public User userLogin(String name, String pwd);

	@Select("select * from users where uname=#{name}")
	public User selectUserByName(String name);

	@Select("select uphone from users where uname=#{name}")
	public String selectPhoneByName(String name);

	@Update("UPDATE users SET upwd=#{password} WHERE uname=#{name}")
	public int changeUserPassword(String name, String password);
}
